package com.yks.hbo.amazon.util;


import com.yks.hbo.amazon.vo.ResultVO;

/**
 * 实体类创建
 * 
 * @author huyong
 * @date 2019年5月14日 19:40
 * 
 */
public class VoHelper {
	public static ResultVO getSuccessResult() {
		return getResultVO("10000"," CommonMessageCodeEnum.SUCCESS.getDesc()", null);
	}

	public static <T> ResultVO getSuccessResult(String msg) {
		return getResultVO("10000", msg, null);
	}

	public static ResultVO getResultVO(String state, String strMsg) {
		return getResultVO(state, strMsg, null);
	}

	public static <T> ResultVO getResultVO(String state, String strMsg, T data) {
		ResultVO rslt = new ResultVO();
		rslt.setData(data);
		rslt.state = state;
		rslt.msg = strMsg;
		return rslt;
	}

	public static ResultVO getErrorResult() {
		return getResultVO("10400", "CommonMessageCodeEnum.FAIL.getDesc()", null);
	}

	public static ResultVO getErrorResult(String strMsg) {
		return getResultVO("10400", strMsg, null);
	}

	public static ResultVO getErrorResult(String state, String strMsg) {
		return getResultVO(state, strMsg, null);
	}

	public static <T> ResultVO getSuccessResult(T data) {
		return getResultVO("10000", "CommonMessageCodeEnum.SUCCESS.getDesc()", data);
	}
}
